Allow null DEF in which-key--process-define-key-args
authorJustin Burkett <justin@burkett.cc>
Wed, 13 Dec 2017 16:10:05 +0000 (11:10 -0500)
committerJustin Burkett <justin@burkett.cc>
Wed, 13 Dec 2017 16:10:05 +0000 (11:10 -0500)
This is useful for naming prefixes

which-key.el

index 22bed0869e5745507e35effe5a669f1136e29eab..15b599a4f1c5b6888674848e484a50252257f296 100644 (file)
@@ -915,11 +915,11 @@ in which-key with DESCRIPTION. This function is meant to be used
 as :before advice for `define-key'."
   (when (and (consp def)
              (stringp (car def))
-             (symbolp (cdr def))
-             (cdr def))
+             (symbolp (cdr def)))
     (let ((key-desc (regexp-quote (key-description key))))
       (push (cons (cons (format "%s\\'" key-desc)
-                        (format "\\`%s\\'" (symbol-name (cdr def))))
+                        (when (cdr def)
+                          (format "\\`%s\\'" (symbol-name (cdr def)))))
                   (cons nil (car def)))
             which-key-replacement-alist))))